"""
@Author:WKVugen
@Time:2023-06-29
@Description: 舔狗日记hhh
"""
import http
import json
import urllib

from utils.config import Config
from utils.log import logger


class LuckyDog:
    url = Config().get('caihong_info')
    def tian_dog_diary(self):
        conn = http.client.HTTPSConnection(self.url['url'])
        params = urllib.parse.urlencode({'key': self.url['key']})
        headers = {'Content-type': 'application/x-www-form-urlencoded'}
        conn.request('POST', '/tiangou/index', params, headers)
        tianapi = conn.getresponse()
        result = tianapi.read()
        data = result.decode('utf-8')
        dict_data = json.loads(data)
        logger.info(dict_data)
        conn.close()
        return dict_data
